package com.tbk.wechatbot.controller;

import com.alibaba.fastjson.JSONObject;
import com.tbk.wechatbot.service.TpwdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/tpwd")
public class TpwdController {

    @Autowired
    private TpwdService tpwdService;

    @RequestMapping("/list_arr")
    @ResponseBody
    public List<String> getMaterialTpwd(@RequestParam(name = "q") String q) {
        List<String> tpwdList = tpwdService.getMaterialTpwd(q);
        if (tpwdList == null) {
            return new ArrayList<>();
        }
        return tpwdList;
    }

}
